//
//  ExercisesQuqestionMainTitleCell.m
//  ShowYork
//
//  Created by hxh on 2020/9/8.
//  Copyright © 2020 hxh. All rights reserved.
//

#import "ExercisesQuqestionChoiceMainTitleCell.h"

@interface ExercisesQuqestionChoiceMainTitleCell ()
@property (nonatomic,strong)UILabel *titleLb;
@property (nonatomic,strong)UILabel *currentIndexLb;
@property (nonatomic,strong)UILabel *totalLb;
@property (nonatomic,strong)UIView *line;
@end

@implementation ExercisesQuqestionChoiceMainTitleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUI];
    }
    return self;
}
- (void)setUI{
    self.titleLb = [[UILabel alloc]init];
    self.titleLb.font = font(14);
    self.titleLb.text = @"文言文语法测验（一）备份";
    self.titleLb.textColor = RGBA(51, 51, 51, 1);
    [self.contentView addSubview:self.titleLb];

    [self.titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(16);
        make.top.equalTo(self.contentView).offset(16);
        make.bottom.equalTo(self.contentView).offset(-16);
    }];
    
    self.totalLb = [[UILabel alloc]init];
    self.totalLb.font = font(12);
    self.totalLb.textColor = RGBA(221, 221, 221, 1);
    self.totalLb.text = @"/24";
    [self.contentView addSubview:self.totalLb];
    [self.totalLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-16);
        make.centerY.equalTo(self.contentView);
    }];
    
    self.currentIndexLb = [[UILabel alloc]init];
    self.currentIndexLb.text = @"1";
    self.currentIndexLb.textColor = [RPAppManager themColor];
    self.currentIndexLb.font = font(14);
    [self.contentView addSubview:self.currentIndexLb];
    [self.currentIndexLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.totalLb).offset(-1);
        make.right.equalTo(self.totalLb.mas_left);
    }];
    
    self.line = [[UIView alloc]init];
    self.line.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.line];
    [self.line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(16);
        make.right.equalTo(self.contentView).offset(-16);
        make.height.mas_equalTo(0.5);
    }];
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    NSString *ID = @"ExercisesQuqestionChoiceMainTitleCell";
    ExercisesQuqestionChoiceMainTitleCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[ExercisesQuqestionChoiceMainTitleCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)setModel:(ExercieseQuestionItemModel *)model{
    _model = model;
    self.currentIndexLb.text = model.currentIndex.stringValue;
    self.totalLb.text = [NSString stringWithFormat:@"/%@",model.totalCount.stringValue];
    self.titleLb.text = model.paperName;
}



@end
